package com.chinasofti.shoot;

import java.util.Random;

//小蜜蜂即是飞行物也是奖励
public class Bee extends FlyingObject implements Award {
    private  int xSpeed=1;//x坐标的步数
    private  int ySpeed=1;//y坐标的步数
    private  int awardType;//奖励类型

    @Override
    public int getType() {
        return awardType;
    }

    public  Bee(){
        imge=ShootGame.bee;
        width = imge.getWidth();
        height = imge.getHeight();
        Random random = new Random();
        x=random.nextInt(ShootGame.WIDTH-this.width);//随机的x坐标
       //固定的y坐标
        y=-this.height;//随机的y坐标
        awardType = random.nextInt(2);
    }

    @Override
    public void step() {
        x+=xSpeed;
        y+=ySpeed;
        if (x>ShootGame.WIDTH-this.width){//最右边
             xSpeed=-1;
        }
        if (x<0){//最左边
            xSpeed=1;
        }
    }

    @Override
    public boolean outOfBounds() {
        return this.y>ShootGame.HEIGHT;
    }
}
